package com.well.menjin.service.impl;

import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.well.menjin.dao.IMenuDao;
import com.well.menjin.domain.Menu;
import com.well.menjin.model.TreeNode;
import com.well.menjin.service.IOperatorService;
/**
 * 
* @ClassName: OperatorServiceImpl 
* @Description: 操作员业务层实现类 
* @author 姜俊健 
* @date 2016年6月7日 下午10:56:58 
*
 */
@Service
@Transactional
public class OperatorServiceImpl implements IOperatorService {

	@Autowired
	private IMenuDao menuDao ;

	@Override
	public List<TreeNode> getMenus(String pid) {
		// TODO Auto-generated method stub
		List<Menu> menus= menuDao.getMenus(pid);
		List<TreeNode> results = new ArrayList<>();
		for(Menu menu:menus){
			TreeNode treeNode = new TreeNode();
			treeNode.setMenuid(menu.getMenuid());
			treeNode.setText(menu.getMenuname());
			treeNode.setLeaf(true);
			results.add(treeNode);
		}
		return results;
	}

	


}
